<?php


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
use think\facade\Cache;
use App\Models\Admin as AdminModel;
use Illuminate\Support\Facades\Redis;

class Login extends Controller{

    public function mockLogin(Request $request){
        //$data  = $request->all();
        $id    = 1;
        $info  = AdminModel::where('id',$id)->first();
        $token = sha1(md5(uniqid(), true));
        Redis::set(AdminModel::LOGIN_PREFIX . md5($token), json_encode($info->toArray()), 2592000);
        return $this->success([
            'token' => $token,
            'userInfo' => $info,
        ]);



    }
}
